//
//  SecondHandViewController.m
//  OneCreditTreasure
//
//  Created by iOS Grouper on 16/8/26.
//
//

#import "SecondHandViewController.h"
#import "SecondHandTableViewCell.h"
#import "CarDetailViewController.h"
@interface SecondHandViewController ()<UITableViewDelegate,UITableViewDataSource>{
    UITableView *myTableView;
}

@end

@implementation SecondHandViewController

- (void)viewWillAppear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"二手车库";
    self.view.backgroundColor = LV;
    [self creatView];
    
}

- (void)creatView{
    myTableView = [UITableView new];
    [self.view addSubview:myTableView];
    [myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(self.view);
        make.width.mas_equalTo(kScreenW);
        make.height.mas_equalTo(self.view);
        
    }];
    myTableView.backgroundColor = LV;
    myTableView.delegate = self;
    myTableView.dataSource = self;
    [myTableView registerClass:[SecondHandTableViewCell class] forCellReuseIdentifier:@"SecondHandTableViewCell"];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SecondHandTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SecondHandTableViewCell"];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 250 * AUTO_HEIGHT;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    CarDetailViewController *car = [CarDetailViewController new];
    [self.navigationController pushViewController:car animated:YES];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
